# -*- codeing =utf-8 -*-
# @Time : 2022/9/14 下午4:12
# @Author :WXJ
# @File : 3.6.py
# @Software: PyCharm

import random
red=0
yellow=0
green=0
num = red + yellow + green
print("红球3个，黄球3个，绿球6个，每次任意选择8个球")
print("请问需要随机选择几次")
while 1:
    x=int(input())
    for i in range(x):
        num=0
        print("第%d次选择："%(i+1),end="")
        while num!=8:
            red=random.randint(1,3)
            yellow= random.randint(1, 3)
            green=random.randint(1,6)
            num=red+yellow+green
        print("红球有%d个，黄球有%d个，绿球有%d个"%(red,yellow,green))
    break